<?php
	include_once 'isLogin.php';
	
	if($_GET['action']=="pwd"){
		$row = $commonc->getInfo('admin',$_COOKIE['admin_id'],'pwd');

		if(md5($_GET['oldpwd'])==$row['pwd']){
			echo "1";
		}else{
			echo "0";
		}
		exit();
	}
	
	if($_POST['submit']){
		$row = $commonc->getInfo('admin',$_COOKIE['admin_id'],'name,pwd');
		
		if(md5($_POST['oldpwd'])==$row['pwd']){
			$update="update admin set pwd='".md5($_POST['pwd1'])."' where id='".$_COOKIE['admin_id']."'";
			$commonc->query($update);
			
			echo $commonc->submitAlert('密码修改成功','xgmm.php');
		}else{
			echo $commonc->submitAlert('原密码输入错误,请重新输入','xgmm.php');
		}
	}
	
	$smarty->display("xgmm.html");
?>